#!/bin/bash
# Quick start script for Rehabilitation Assessment System

echo "=================================="
echo "康复动作评估系统 - 快速启动"
echo "=================================="
echo ""

# Check if virtual environment exists
if [ ! -d "venv" ]; then
    echo "创建虚拟环境..."
    python3 -m venv venv
    echo "✓ 虚拟环境创建完成"
    echo ""
fi

# Activate virtual environment
echo "激活虚拟环境..."
source venv/bin/activate
echo "✓ 虚拟环境已激活"
echo ""

# Check if dependencies are installed
if ! python -c "import mediapipe" &> /dev/null; then
    echo "安装依赖包..."
    pip install -r requirements.txt
    echo "✓ 依赖包安装完成"
    echo ""
else
    echo "✓ 依赖包已安装"
    echo ""
fi

# Create necessary directories
echo "创建必要目录..."
mkdir -p logs models cache
echo "✓ 目录创建完成"
echo ""

# Start API server
echo "=================================="
echo "启动 API 服务器..."
echo "=================================="
echo ""
echo "访问地址: http://localhost:5000"
echo "健康检查: http://localhost:5000/health"
echo ""
echo "按 Ctrl+C 停止服务器"
echo ""

python src/api/app.py
